﻿using System.Collections;
using System.Collections.Generic;
using GameFramework.DataTable;
using UnityEngine;
using UnityGameFramework.Runtime;

namespace StarForce {
    public class CardData : EntityData {
        [SerializeField] private string m_CardName;
        [SerializeField] private string m_CardDesc;
        [SerializeField] private Vector2 m_CardSize;
        private int m_CardID = 0;
        private Sprite m_CardIcon;
        private UiCardParameters m_parameters = null;
        private PlayerHand m_PlayerHand = null;
        public CardData(int entityId, int typeId,int cardId,UiCardParameters parameters) : base(entityId, typeId) {
            m_CardID = cardId;
            m_parameters = parameters;
            IDataTable<DRCard> dtCard = GameEntry.DataTable.GetDataTable<DRCard>();
            DRCard drCard = dtCard.GetDataRow(m_CardID);
            if (drCard == null) {
                return;
            }
            m_CardName = drCard.CardName;
            m_CardDesc = drCard.CardDesc;
            m_CardIcon = AtlasManager.GetSprite(drCard.IconId);
        }

        /// <summary>
        /// 卡牌名称
        /// </summary>
        public string CardName {
            get => m_CardName;
            private set => m_CardName = value;
        }

        /// <summary>
        /// 获取卡牌描述
        /// </summary>
        public string CardDesc {
            get => m_CardDesc;
            private set => m_CardDesc = value;
        }

        /// <summary>
        /// 获取卡牌图标
        /// </summary>
        public Sprite CardIcon {
            get => m_CardIcon;
            private set => m_CardIcon = value;
        }
        
        /// <summary>
        /// 卡牌大小
        /// </summary>
        public Vector2 CardSize {
            get => m_CardSize;
            set => m_CardSize = value;
        }
        
        /// <summary>
        /// 卡牌ID
        /// </summary>
        public int CardID {
            get => m_CardID;
            private set => m_CardID = value;
        }

        public UiCardParameters Parameters {
            get => m_parameters;
            set => m_parameters = value;
        }

        public PlayerHand PlayerHand {
            get => m_PlayerHand;
            set => m_PlayerHand = value;
        }
    }
}
